package com.zonda.sampleretrofit2.view;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.FrameLayout;
import android.widget.TextView;

import com.zonda.sampleretrofit2.R;

public class TestListItemLayout extends FrameLayout {

  private final static String LOG_TAG = "TestListItemLayout";

  private TextView mTitleTv;

  public TestListItemLayout(Context context) {
    super(context);
    init();
  }

  public TestListItemLayout(Context context, AttributeSet attrs) {
    super(context, attrs);
    init();
  }

  private void init() {
    inflate(getContext(), R.layout.test_item, this);
    mTitleTv = (TextView) findViewById(R.id.test_item_title);
  }

  @Override
  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    Log.i(LOG_TAG, "onMeasure ------- " + mTitleTv.getText());
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  }

  public void setTitleText(String titleText) {
    mTitleTv.setText(titleText);
  }
}
